<?php
class WebConfigModel extends Model {
	/**
	* 获取网站配置
	* return array
	*/
	public function getWebConfig(){
		if(!($result = F('web_config'))){
			$info   = $this->select();
			$result = array();
			foreach($info as $key=>$val){
				$result[$val['config_name']] = $val['config_value'];
			}
			F('web_config', $result);
		}
		return $result;
	}
	
 /**
	* 更新网站配置
	* return true
	*/
	public function updateConfig(){
		foreach ($_POST as $key => $val){
			$this->where(array('config_name'=>$key))->save(array('config_value'=>trim($val)));
		}
		return true;
	}
}